﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using netDxf;
using netDxf.Blocks;
using netDxf.Collections;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Objects;
using netDxf.Tables;
using netDxf.Units;
using Attribute = netDxf.Entities.Attribute;
using Image = netDxf.Entities.Image;
using Point = netDxf.Entities.Point;
using Trace = netDxf.Entities.Trace;
using System.Threading;
using System.Windows.Media.Media3D;
using System.Runtime.Remoting.Messaging;

namespace TestDxfDocument
{

    class _Tapswithchipremovalholeforunifiedthreads
    {
        public static void Tapswithchipremovalholeforunifiedthreads(Dictionary<string, Object> data)//细柄丝锥
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            refin.Linetype = Linetype.Dashed;
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            centre.Linetype = Linetype.DashDot;
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");     //skview尺寸线层
                                                                            //坐标
                                                                            //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            
             double d = Convert.ToDouble(data["td"]);
             double d1 = Convert.ToDouble(data["dconms"]);
             double p = Convert.ToDouble(data["tp"]);
             double L = Convert.ToDouble(data["oal"]);
             double l = Convert.ToDouble(data["thl"]);
             double a = Convert.ToDouble(data["drvsc"]);
             double l2 = Convert.ToDouble(data["drvl"]);
             double r = Convert.ToDouble(data["re"]);
             double l3 = Convert.ToDouble(data["tcl"])*p;
           


             //坐标
            Vector2 v1 = new Vector2(0, 0);
            Vector2 v2 = new Vector2(v1.X, v1.Y - 0.4458 * d);
            Vector2 v3 = new Vector2(v2.X + l3, v2.Y - 0.057 * d);
            Vector2 v4 = new Vector2(v3.X + (l - l3), v3.Y);
            Vector2 v5 = new Vector2(v4.X + 0.057 * d, v4.Y + 0.057 * d);
            Vector2 v6 = new Vector2(v4.X + 0.1534 * d, v4.Y + 0.1618 * d);
            Vector2 v7 = new Vector2(v6.X + 0.1637 * L, v6.Y);
            Vector2 v8 = new Vector2(v7.X + 0.0853 * L, v7.Y);
            Vector2 v9 = new Vector2(v8.X + 0.2164 * L, v8.Y);
            Vector2 v10 = new Vector2(v9.X + l2, v9.Y);
            Vector2 v11 = new Vector2(v9.X , v1.Y -0.0939 * d1);
            Vector2 v12 = new Vector2(v10.X, v1.Y -0.0939 * d1);
            Vector2 v13 = new Vector2(v11.X, v11.Y * -1);
            Vector2 v14 = new Vector2(v12.X, v12.Y * -1);
            Vector2 v15 = new Vector2(v10.X, v10.Y * -1);
            Vector2 v16 = new Vector2(v9.X, v9.Y * -1);
            Vector2 v17 = new Vector2(v8.X, v8.Y * -1);
            Vector2 v18 = new Vector2(v7.X, v7.Y * -1);
            Vector2 v19 = new Vector2(v6.X, v6.Y * -1);
            Vector2 v20 = new Vector2(v5.X, v5.Y * -1);
            Vector2 v21 = new Vector2(v4.X, v4.Y * -1);
            Vector2 v22 = new Vector2(v3.X, v3.Y * -1);
            Vector2 v23 = new Vector2(v2.X, v2.Y * -1);
            Vector2 v24 = new Vector2(v23.X, v23.Y - 0.0847 * d);
            Vector2 v25 = new Vector2(v24.X + 0.3068 * l, v24.Y - 0.0238 * d);
            Vector2 v26 = new Vector2(v25.X, v25.Y - 0.0483 * d);
            Vector2 v27 = new Vector2(v24.X+0.0648*l,v24.Y-0.046*d);
            Vector2 v28 = new Vector2(v26.X, v26.Y - 0.0791 * d);
            Vector2 v29 = new Vector2(v27.X, v27.Y - 0.1419 * d);
            Vector2 v30 = new Vector2(v24.X, v24.Y - 0.1982 * d);
            Vector2 v31 = new Vector2(v1.X, v1.Y - 0.0961 * d);
            Vector2 v35 = new Vector2(v1.X, v1.Y - 0.2122 * d);
            Vector2 v36 = new Vector2(v1.X, v1.Y - 0.2781 * d);
            Vector2 v32 = new Vector2(v31.X + 0.2955 * l, v31.Y - 0.0188 * d);
            Vector2 v33 = new Vector2(v32.X, v32.Y - 0.0496 * d);
            Vector2 v37 = new Vector2(v33.X, v33.Y - 0.0798 * d);
            Vector2 v34 = new Vector2(v35.X + 0.0624 * l, v35.Y + 0.0101 * d);
            Vector2 v38 = new Vector2(v34.X, v34.Y - 0.0689 * d);
            Vector2 v39 = new Vector2(v2.X, v2.Y + 0.0931 * d);
            Vector2 v40 = new Vector2(v39.X + 0.0674 * l, v39.Y + 0.0279 * d);
            Vector2 v41 = new Vector2(v3.X + 0.1444 * l, v3.Y);
            Vector2 v42 = new Vector2(v41.X, v41.Y + 0.1928 * d);
            Vector2 v43 = new Vector2(v42.X + 0.4124 * l, v42.Y + 0.0493 * d);
            Vector2 v44 = new Vector2(v43.X + 0.0663 * l, v43.Y + 0.0753 * d);
            Vector2 v45 = new Vector2(v44.X, v44.Y + 0.0142 * d);
            Vector2 v46 = new Vector2(v45.X + 0.0244 * l, v45.Y + 0.0168 * d);
            Vector2 v47 = new Vector2(v43.X, v43.Y * -1);
            Vector2 v48 = new Vector2(v44.X, v44.Y * -1);
            Vector2 v49 = new Vector2(v45.X, v45.Y * -1);
            Vector2 v50 = new Vector2(v46.X, v46.Y * -1);
            Vector2 v51 = new Vector2(v46.X + 0.2164*L, v46.Y);
            Vector2 v52 = new Vector2(v51.X, v50.Y );
            Vector2 v53 = new Vector2(v52.X + 0.0292 * L, v50.Y - 0.238 * d1);
            Vector2 v68 = new Vector2(v23.X+0.3078*l, v22.Y);
            Vector2 v67 = new Vector2(v68.X, v42.Y * -1);
            Vector2 v54 = new Vector2(v51.X + 0.0197 * L, v51.Y - 0.0883 * d1);
            Vector2 v57 = new Vector2(v54.X + 0.0089 * L, v54.Y - 0.0404 * d1);
            Vector2 v56 = new Vector2(v57.X + 0.04 * L, v57.Y + 0.1919 * d1);
            Vector2 v55 = new Vector2(v54.X + 0.04 * L, v54.Y + 0.1919 * d1);
            Vector2 v58 = new Vector2(v55.X, v55.Y * -1);
            Vector2 v60 = new Vector2(v56.X, v56.Y * -1);
            Vector2 v59 = new Vector2(v54.X, v54.Y * -1);
            Vector2 v61 = new Vector2(v57.X, v57.Y * -1);
            Vector2 v62 = new Vector2(v18.X + 0.04265 * L, v18.Y);
            Vector2 v63 = new Vector2(v62.X, v62.Y * -1);
            Vector2 v64 = new Vector2(v11.X + 0.8734*l2, v11.Y);
            Vector2 v65 = new Vector2(v64.X, v13.Y);
            Vector2 v69 = new Vector2(v10.X,v51.Y);
            Vector2 v70 = new Vector2(v1.X -0.1 * l, v1.Y);
            Vector2 v71 = new Vector2(v1.X + 1.1 * L, v1.Y);
            Vector2 v72 = new Vector2(v51.X , v1.Y);
            Vector2 v73 = new Vector2(v10.X, v52.Y);
            Vector2 v74 = new Vector2(v64.X + 0.3034 * L, v64.Y);
            Vector2 v75 = new Vector2(v74.X + 0.5116 * a, v74.Y - 0.5116 * a);
            Vector2 v76 = new Vector2(v75.X + 0.1951 * a, v75.Y);
            Vector2 v77 = new Vector2(v76.X + 0.5116 * a, v76.Y + 0.5116 * a);
            Vector2 v78 = new Vector2(v77.X, v77.Y + 0.1951 * a);
            Vector2 v79 = new Vector2(v76.X, v76.Y * -1);
            Vector2 v80 = new Vector2(v75.X, v75.Y * -1);
            Vector2 v81 = new Vector2(v65.X + 0.3034 * L, v65.Y);
            Vector2 v82 = new Vector2(v74.X - 0.5 * a, v1.Y);
            Vector2 v83 = new Vector2(v75.X + 0.0975 * a, v75.Y - 0.5 * a);
            Vector2 v84 = new Vector2(v77.X + 0.5 * a, v82.Y);
            Vector2 v85 = new Vector2(v83.X, v79.Y + 0.5 * a);






            //作图
            LwPolyline line1 = new LwPolyline();
            line1.Vertexes.Add(new LwPolylineVertex(v1));
            line1.Vertexes.Add(new LwPolylineVertex(v2));
            line1.Vertexes.Add(new LwPolylineVertex(v3));
            line1.Vertexes.Add(new LwPolylineVertex(v4));
            line1.Vertexes.Add(new LwPolylineVertex(v5));
            line1.Vertexes.Add(new LwPolylineVertex(v6));
            line1.Vertexes.Add(new LwPolylineVertex(v7));
            line1.Vertexes.Add(new LwPolylineVertex(v8));
            line1.Vertexes.Add(new LwPolylineVertex(v9));
            line1.Vertexes.Add(new LwPolylineVertex(v10));
            line1.Vertexes.Add(new LwPolylineVertex(v12));
            line1.Vertexes.Add(new LwPolylineVertex(v11));
            line1.Vertexes.Add(new LwPolylineVertex(v9));
            line1.Vertexes[6].Bulge = Math.Tan(-56 * pi / 180 / 4);
            var arc1 = Pus.Fillet4LwPline(line1, 9, r);
            var arc2 = Pus.Fillet4LwPline(arc1, 11, r);
            fun.PolyFill(dxf, arc2, 0.05, contour);

            //作图
            LwPolyline line2 = new LwPolyline();
            line2.Vertexes.Add(new LwPolylineVertex(v16));
            line2.Vertexes.Add(new LwPolylineVertex(v13));
            line2.Vertexes.Add(new LwPolylineVertex(v14));
            line2.Vertexes.Add(new LwPolylineVertex(v15));
            line2.Vertexes.Add(new LwPolylineVertex(v16));
            line2.Vertexes.Add(new LwPolylineVertex(v17));
            line2.Vertexes.Add(new LwPolylineVertex(v18));
            line2.Vertexes.Add(new LwPolylineVertex(v19));
            line2.Vertexes.Add(new LwPolylineVertex(v20));
            line2.Vertexes.Add(new LwPolylineVertex(v21));
            line2.Vertexes.Add(new LwPolylineVertex(v22));
            line2.Vertexes.Add(new LwPolylineVertex(v23));
            line2.Vertexes.Add(new LwPolylineVertex(v24));
            line2.Vertexes.Add(new LwPolylineVertex(v27));
            line2.Vertexes.Add(new LwPolylineVertex(v26));
            line2.Vertexes.Add(new LwPolylineVertex(v25));
            line2.Vertexes.Add(new LwPolylineVertex(v24));
            line2.Vertexes.Add(new LwPolylineVertex(v30));
            line2.Vertexes.Add(new LwPolylineVertex(v29));
            line2.Vertexes.Add(new LwPolylineVertex(v28));
            line2.Vertexes.Add(new LwPolylineVertex(v26));
            line2.Vertexes.Add(new LwPolylineVertex(v27));
            line2.Vertexes.Add(new LwPolylineVertex(v29));
            line2.Vertexes[5].Bulge = Math.Tan(-56 * pi / 180 / 4);
            var arc3 = Pus.Fillet4LwPline(line2, 2, r);
            var arc4 = Pus.Fillet4LwPline(arc3, 4, r);
            fun.PolyFill(dxf, arc4, 0.05, contour);


            //作图
            LwPolyline line3 = new LwPolyline();
            line3.Vertexes.Add(new LwPolylineVertex(v31));
            line3.Vertexes.Add(new LwPolylineVertex(v32));
            line3.Vertexes.Add(new LwPolylineVertex(v33));
            line3.Vertexes.Add(new LwPolylineVertex(v37));
            line3.Vertexes.Add(new LwPolylineVertex(v38));
            line3.Vertexes.Add(new LwPolylineVertex(v36));
            line3.Vertexes.Add(new LwPolylineVertex(v35));
            line3.Vertexes.Add(new LwPolylineVertex(v34));
            line3.Vertexes.Add(new LwPolylineVertex(v33));
            line3.Vertexes.Add(new LwPolylineVertex(v37));
            line3.Vertexes.Add(new LwPolylineVertex(v38));
            line3.Vertexes.Add(new LwPolylineVertex(v34));
            line3.Vertexes.Add(new LwPolylineVertex(v35));
            line3.Vertexes.Add(new LwPolylineVertex(v2));
            line3.Vertexes.Add(new LwPolylineVertex(v23));
            fun.PolyFill(dxf, line3, 0.05, contour);

            //作图
            Line line4 = new Line(v39, v40);
            line4.Layer = refin;
            line4.Linetype = Linetype.Dashed;
            line4.LinetypeScale = 3;
            dxf.AddEntity(line4);

           
            Line line5 = new Line(v40, v42);
            line5.Layer = refin;
            line5.Linetype = Linetype.Dashed;
            line5.LinetypeScale = 3;
            dxf.AddEntity(line5);

            Line line6 = new Line(v42, v41);
            line6.Layer = refin;
            line6.Linetype = Linetype.Dashed;
            line6.LinetypeScale = 3;
            dxf.AddEntity(line6);

            Line line7 = new Line(v42, v43);
            line7.Layer = refin;
            line7.Linetype = Linetype.Dashed;
            line7.LinetypeScale = 3;
            dxf.AddEntity(line7);

            Line line8 = new Line(v43, v44);
            line8.Layer = refin;
            line8.Linetype = Linetype.Dashed;
            line8.LinetypeScale = 3;
            dxf.AddEntity(line8);

            Line line9 = new Line(v44, v49);
            line9.Layer = refin;
            line9.Linetype = Linetype.Dashed;
            line9.LinetypeScale = 3;
            dxf.AddEntity(line9);

            Line line10 = new Line(v68, v67);
            line10.Layer = refin;
            line10.Linetype = Linetype.Dashed;
            line10.LinetypeScale = 3;
            dxf.AddEntity(line10);

            Line line11 = new Line(v67, v47);
            line11.Layer = refin;
            line11.Linetype = Linetype.Dashed;
            line11.LinetypeScale = 3;
            dxf.AddEntity(line11);

            Line line12 = new Line(v47, v48);
            line12.Layer = refin;
            line12.Linetype = Linetype.Dashed;
            line12.LinetypeScale = 3;
            dxf.AddEntity(line12);

            Line line13 = new Line(v48, v49);
            line13.Layer = refin;
            line13.Linetype = Linetype.Dashed;
            line13.LinetypeScale = 3;
            dxf.AddEntity(line13);

            Line line14 = new Line(v49, v50);
            line14.Layer = refin;
            line14.Linetype = Linetype.Dashed;
            line14.LinetypeScale = 3;
            dxf.AddEntity(line14);

            Line line15 = new Line(v45, v46);
            line15.Layer = refin;
            line15.Linetype = Linetype.Dashed;
            line15.LinetypeScale = 3;
            dxf.AddEntity(line15);

            Line line16 = new Line(v46, v50);
            line16.Layer = refin;
            line16.Linetype = Linetype.Dashed;
            line16.LinetypeScale = 3;
            dxf.AddEntity(line16);

            Line line17 = new Line(v50, v52);
            line17.Layer = refin;
            line17.Linetype = Linetype.Dashed;
            line17.LinetypeScale = 3;
            dxf.AddEntity(line17);

            Line line18 = new Line(v46, v51);
            line18.Layer = refin;
            line18.Linetype = Linetype.Dashed;
            line18.LinetypeScale = 3;
            dxf.AddEntity(line18);

            Line line19 = new Line(v51, v52);
            line19.Layer = refin;
            line19.Linetype = Linetype.Dashed;
            line19.LinetypeScale = 3;
            dxf.AddEntity(line19);

            Line line20 = new Line(v51, v53);
            line20.Layer = refin;
            line20.Linetype = Linetype.Dashed;
            line20.LinetypeScale = 3;
            dxf.AddEntity(line20);

            Line line21 = new Line(v52, v53);
            line21.Layer = refin;
            line21.Linetype = Linetype.Dashed;
            line21.LinetypeScale = 3;
            dxf.AddEntity(line21);

            Line line22 = new Line(v51, v7);
            line22.Layer = refin;
            line22.Linetype = Linetype.Dashed;
            line22.LinetypeScale = 3;
            dxf.AddEntity(line22);

            Line line23 = new Line(v53, v8);
            line23.Layer = refin;
            line23.Linetype = Linetype.Dashed;
            line23.LinetypeScale = 3;
            dxf.AddEntity(line23);

            Line line24 = new Line(v52, v18);
            line24.Layer = refin;
            line24.Linetype = Linetype.Dashed;
            line24.LinetypeScale = 3;
            dxf.AddEntity(line24);

            Line line25 = new Line(v53, v17);
            line25.Layer = refin;
            line25.Linetype = Linetype.Dashed;
            line25.LinetypeScale = 3;
            dxf.AddEntity(line25);

            Line line26 = new Line(v59, v58);
            line26.Layer = refin;
            line26.Linetype = Linetype.Dashed;
            line26.LinetypeScale = 3;
            dxf.AddEntity(line26);

            Line line27 = new Line(v61, v60);
            line27.Layer = refin;
            line27.Linetype = Linetype.Dashed;
            line27.LinetypeScale = 3;
            dxf.AddEntity(line27);

            Line line28 = new Line(v55, v54);
            line28.Layer = refin;
            line28.Linetype = Linetype.Dashed;
            line28.LinetypeScale = 3;
            dxf.AddEntity(line28);

            Line line29 = new Line(v56, v57);
            line29.Layer = refin;
            line29.Linetype = Linetype.Dashed;
            line29.LinetypeScale = 3;
            dxf.AddEntity(line29);

            Line line30 = new Line(v70, v71);
            line30.Layer = centre;
            line30.Linetype = Linetype.DashDot;
            line30.LinetypeScale = 3;
            dxf.AddEntity(line30);

            Line line31 = new Line(v72, v63);
            line31.Layer = centre;
            line31.Linetype = Linetype.DashDot;
            line31.LinetypeScale = 3;
            dxf.AddEntity(line31);

            Line line32 = new Line(v72, v62);
            line32.Layer = centre;
            line32.Linetype = Linetype.DashDot;
            line32.LinetypeScale = 3;
            dxf.AddEntity(line32);

            LwPolyline line33 = new LwPolyline();
            line33.Vertexes.Add(new LwPolylineVertex(v64));
            line33.Vertexes.Add(new LwPolylineVertex(v65));
            fun.PolyFill(dxf, line33, 0.05, contour);

            LwPolyline line34 = new LwPolyline();
            line34.Vertexes.Add(new LwPolylineVertex(v69));
            line34.Vertexes.Add(new LwPolylineVertex(v73));
            fun.PolyFill(dxf, line34, 0.05, contour);

            //作图
            LwPolyline line35 = new LwPolyline();
            line35.Vertexes.Add(new LwPolylineVertex(v74));
            line35.Vertexes.Add(new LwPolylineVertex(v75));
            line35.Vertexes.Add(new LwPolylineVertex(v76));
            line35.Vertexes.Add(new LwPolylineVertex(v77));
            line35.Vertexes.Add(new LwPolylineVertex(v78));
            line35.Vertexes.Add(new LwPolylineVertex(v79));
            line35.Vertexes.Add(new LwPolylineVertex(v80));
            line35.Vertexes.Add(new LwPolylineVertex(v81));
            line35.Vertexes.Add(new LwPolylineVertex(v74));
            fun.PolyFill(dxf, line35, 0.05, contour);


            LwPolyline hatchpoly1 = new LwPolyline();
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v74));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v75));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v76));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v77));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v78));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v79));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v80));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v81));
            hatchpoly1.IsClosed = true;
            String[] htype1 = new String[100];
            Line[] hline1 = new Line[100];
            Arc[] harc1 = new Arc[100];
            int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
            for (int I = 0; I < hnumst1; I++)
            {
                htype1[I] = hatchpoly1.Explode()[I].Type.ToString();    //将所有的元素记录成一个数组
                if (htype1[I] == "Line")
                {
                    hline1[I] = (Line)hatchpoly1.Explode()[I];
                }
                if (htype1[I] == "Arc")
    {
                    harc1[I] = (Arc)hatchpoly1.Explode()[I];
                }
            }
            fun.hatchsub1(dxf, htype1, hnumst1, 45, 10, hline1, harc1, hatching);

            //作图
            LwPolyline line36 = new LwPolyline();
            line36.Vertexes.Add(new LwPolylineVertex(v2));
            line36.Vertexes.Add(new LwPolylineVertex(v5));
            fun.PolyFill(dxf, line36, 0.05, contour);

            LwPolyline line37 = new LwPolyline();
            line37.Vertexes.Add(new LwPolylineVertex(v20));
            line37.Vertexes.Add(new LwPolylineVertex(v23));
            fun.PolyFill(dxf, line37, 0.05, contour);

            LwPolyline line38 = new LwPolyline();
            line38.Vertexes.Add(new LwPolylineVertex(v3));
            line38.Vertexes.Add(new LwPolylineVertex(v22));
            fun.PolyFill(dxf, line38, 0.05, contour);

            LwPolyline line39 = new LwPolyline();
            line39.Vertexes.Add(new LwPolylineVertex(v4));
            line39.Vertexes.Add(new LwPolylineVertex(v21));
            fun.PolyFill(dxf, line39, 0.05, contour);

            Line line40 = new Line(v82, v84);
            line40.Layer = centre;
            line40.Linetype = Linetype.DashDot;
            line40.LinetypeScale = 3;
            dxf.AddEntity(line40);

            Line line41 = new Line(v83, v85);
            line41.Layer = centre;
            line41.Linetype = Linetype.DashDot;
            line41.LinetypeScale = 3;
            dxf.AddEntity(line41);





            fun.dimrot1(dxf, v2, v3, -180, l * 1, 1, 1.2, 1.6, 0, "TCL="+l3, "", "");
            fun.dimrot1(dxf, v2, v4, 0, l * 2, 1, 1.2, 1.6, 0, "THL="+l, "", "");
            fun.dimrot1(dxf, v1, v10, -180, l * 1.5, 1, 1.2, 1.6, 0, "OAL="+L, "", "");
            fun.dimrot1(dxf, v9, v10, -180, l * 1, 1, 1.2, 1.6, 0, "DRVL="+l2, "", "");
            fun.dimrot1(dxf, v3, v22, 90, l * 1, 1, 1.2, 1.6, 0, "TD="+d, "", "");
            fun.dimrot1(dxf, v8, v17, -90, l * 0.5, 1, 1.2, 1.6, 0, "DCONMS="+d1, "", "");
            fun.dimrot1(dxf, v74, v79, -135, l * 1, 1, 1.2, 1.6, 0, "DRVSC="+a, "", "");
            fun.jdbz1(dxf, new Line(v28, fun.Polar(v28, 180 * pi / 180, 0.1)), new Line(v28, fun.Polar(v28, -170 * pi / 180, 0.1)), l * 2, "10°=", 3);


            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            double scale = Convert.ToDouble(data["scale"]); //放大系数
            Vector2 p0 = new Vector2(0, 0);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10
                        * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }

            //定义格式，路径导出
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);


        }

    }
}
